import request from '@/utils/request'

const create = (userId, address, data) => {
  return request({
    url: `/orders/create/${userId}?address=${address}`,
    method: 'post',
    data,
  })
}

const listByUserId = (userId) => {
  return request({
    url: `/orders/list/${userId}`,
    method: 'get',
  })
}

const getById = (id) => {
  return request({
    url: `/orders/details/${id}`,
    method: 'get',
  })
}

const send = (id) => {
  return request({
    url: `/orders/send/${id}`,
    method: 'get',
  })
}
const pageByCond = (currentPage, pageSize, data) => {
  return request({
    url: `/orders/list?pageNum=${currentPage}&pageSize=${pageSize}`,
    method: 'post',
    data,
  })
}

export default {
  create,
  listByUserId,
  pageByCond,
  getById,
  send,
}
